<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>getElementByTagName演示文档</title>
    <style>
        body{
            background-size: 50%;
            background-color: aqua;
        }
    </style>
  </head>
  <body ondblclick="myclick()">   
    
    <h1>双击body元素区可以更换壁纸，试试呗</h1>
    
  </body>
  <script>
    var N=0;          //设置全局变量N
    var tags = document.getElementsByTagName("body");
    function myclick() {
        const element = tags[0];
    N++;
    if(N==1){
     element.style.backgroundImage = "url('https://i0.hdslb.com/bfs/article/57fdaebc289cbc158a6f45d65491e4e3f91f36fc.jpg@942w_531h_progressive.webp')";}
        if(N==2){
       element.style.backgroundImage="url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.nga.178.com%2Fattachments%2Fmon_201807%2F29%2F-39t2Q5-fzxZ2cT3cS1hc-u0.jpg&refer=http%3A%2F%2Fimg.nga.178.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668772635&t=3ddd2becbe71eb527ca35c7bd5bfa142')";}
       if(N==3){
    element.style.backgroundImage="url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi0.hdslb.com%2Fbfs%2Farticle%2Fce03eed872f0a08e6b9e9958e64d8cdaad291c3f.jpg&refer=http%3A%2F%2Fi0.hdslb.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668772570&t=a6ccda45550be4e597c89245fe5b6094')";}
       if(N==4){
    element.style.backgroundImage="url('https://i0.hdslb.com/bfs/article/694f07929f1f0e1064300199d8fc5530e1d13a6e.jpg@942w_531h_progressive.webp')";
         N=0;
      }
    }



    document.write("原数组为:[3,6,81,4,0,7]"+"");
argObj(3,6,81,4,0,7);
function argObj() {
    var temp;
    for (var index = 0; index < arguments.length; index++) {
        for(var jindex=index+1;jindex<arguments.length;jindex++){
            if(arguments[index]>arguments[jindex]){
                temp=arguments[jindex];
                arguments[jindex]=arguments[index];
                arguments[index]=temp;
            }
        }
    }
    document.write("按升序排好后的数组为:[")
    for(var i=0;i<arguments.length;i++){
        if(i==arguments.length-1){
            document.write(arguments[i]);
            break;
        }
    document.write(arguments[i]+",");
}
document.write("]");
}

  </script>
</html>